<%--
  Created by IntelliJ IDEA.
  User: zhaoyang
  Date: 2020/8/5
  Time: 4:21 下午
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link rel="icon" href="https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1596120245889&di=5093bcb814a73039583d935c56ee7213&imgtype=0&src=http%3A%2F%2Fen.pimg.jp%2F041%2F867%2F367%2F1%2F41867367.jpg" />


    <title>登录页面</title>


    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.6 -->
    <!-- Font Awesome -->
    <!-- Ionicons -->
    <!-- Theme style -->
    <!-- iCheck -->
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    <link rel="stylesheet" href="../plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../plugins/ionicons/css/ionicons.min.css">
    <link rel="stylesheet" href="../plugins/adminLTE/css/AdminLTE.css">
    <link rel="stylesheet" href="../plugins/iCheck/square/blue.css">
</head>

<body class="hold-transition login-page">

<%
    // 4：登录的时候，在login.jsp中，如果已经登录，则提示欢迎信息，否则显示登录框
    if (session.getAttribute("USER_LOGIN") != null) {
%>
<script>
    alert("您已登陆！")
    location.replace("welcome.jsp");
</script>
<%
    }
%>


<div class="login-box">
    <div class="login-logo">


        <a href="all-admin-index.html"><b>学校</b>后台管理系统</a>


    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
        <p class="login-box-msg">登录系统</p>

<%--        <form action="<%=request.getContextPath()%>/AdminLTEdemo01/s_login/doLogin.jsp" method="post">--%>
        <form action="<%=request.getContextPath()%>/doAdminLoginServlet" method="post">

            <%
                // 查看cookie
                Cookie []cookies=request.getCookies();
                String userName="";
                for (int i=0;cookies!=null&&i<cookies.length;i++){
                    if (cookies[i].getName().equals("userName")) {
                        userName=cookies[i].getValue();
                        break;
                    }
                }
            %>

            <div class="form-group has-feedback">
                <input type="text" class="form-control" placeholder="登录账号" name="username" value="<%=userName%>">
                <span class="glyphicon glyphicon-user form-control-feedback"></span>
            </div>
            <div class="form-group has-feedback">
                <input type="password" class="form-control" placeholder="登录密码" name="password">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>
            <div class="row">
                <div class="col-xs-8">
                    <div class="checkbox icheck">
                        <label><input type="checkbox"> 记住 下次自动登录</label>
                    </div>
                </div>
                <!-- /.col -->
                <div class="col-xs-4">
                    <button type="submit" class="btn btn-primary btn-block btn-flat">登录</button>
                </div>
                <!-- /.col -->
            </div>
        </form>

<%--        <div class="social-auth-links text-center">--%>
<%--            <p>- 或者 -</p>--%>
<%--            <a href="#" class="btn btn-block btn-social btn-facebook btn-flat"><i class="fa fa-qq"></i> 腾讯QQ用户登录</a>--%>
<%--            <a href="#" class="btn btn-block btn-social btn-google btn-flat"><i class="fa fa-weixin"></i> 微信用户登录</a>--%>
<%--        </div>--%>
        <!-- /.social-auth-links -->

        <a href="#">忘记密码</a><br>
        <a href="all-admin-register.html" class="text-center">新用户注册</a>

    </div>
    <!-- /.login-box-body -->
</div>
<!-- /.login-box -->

<!-- jQuery 2.2.3 -->
<!-- Bootstrap 3.3.6 -->
<!-- iCheck -->
<script src="../plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="../plugins/bootstrap/js/bootstrap.min.js"></script>
<script src="../plugins/iCheck/icheck.min.js"></script>
<script>
    $(function() {
        $('input').iCheck({
            checkboxClass: 'icheckbox_square-blue',
            radioClass: 'iradio_square-blue',
            increaseArea: '20%' // optional
        });
    });
</script>
</body>

</html>